home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 43.zip
/
Sources C - WorkDisk IV.adf
/
vertbinterrupt.c
< prev
Wrap
C/C++ Source or Header
|
1987-02-15
|
875b
|
42 lines
#include "exec/types.h"
#include "exec/memory.h"
#include "exec/interrupts.h"
#include "hardware/custom.h"
#include "hardware/intbits.h"
struct Interrupt *VertBIntr;
long count;
void VertBServer()
{
int_start();
count++;
int_end();
}
main()
{
VertBIntr= (struct Interrupt *)AllocMem((LONG)sizeof(struct Interrupt),MEMF_PUBLIC);
if(VertBIntr==0)
{
puts("Not enough memory for interrupt server!\n");
exit(100);
}
VertBIntr->is_Node.ln_Type=NT_INTERRUPT;
VertBIntr->is_Node.ln_Pri=-60;
VertBIntr->is_Node.ln_Name="VertB-example";
VertBIntr->is_Data=(APTR)&count;
VertBIntr->is_Code=(VOID(*)())VertBServer;
AddIntServer(INTB_VERTB,VertBIntr);
puts("Type q to quit... reports how many vblanks since start\n");
while(getchar()!='q');
RemIntServer(INTB_VERTB,VertBIntr);
printf("%ld vertical blanks counted!\n",count);
FreeMem(VertBIntr,(LONG)sizeof(struct Interrupt));
}